﻿using MES.Desktop.Entities;
using MES.Desktop.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MES.Desktop.Service
{
    public class ServiceBase
    {
        public T GetResult<T>(string json)
        {
            var result = JsonUtil.Deserializer<ApiDataResult<T>>(json);

            if (result == null)
                throw new Exception("数据获取失败!");
            if (!result.Success)
                throw new Exception(result.Message);

            return result.Data;
        }
    }
}
